#include <iostream>
#include <vector>
#include <thread>
int f(ring<int>* r) {
	int i = -1,j=-1;
	while (1) {
		if (r->ring_dequeue(i)) {
			if (j != i - 1) {
				cout << "error-----------------------------------" << endl;
			}
			cout << i << endl;
		}
	}
}

int main() {
	ring<int> r(10);
	thread t(f, &r);
	for (int i = 0; i < 1001; ) {
		if (r.ring_enqueue(i)) {
			i++;
		}
	}
	t.join();
	return 0;
}
